
{
	var newscript = document.createElement('script');
	newscript.setAttribute('type','text/javascript');
	newscript.setAttribute('src','../scripts/std_sys.js');
	var head = document.getElementsByTagName('head')[0];
	head.appendChild(newscript);
	newscript.onload=function(){
		start();
	}
}
if (!window.localStorage) {
	console.log('浏览器版本太低，不支持localStorage');
} else {
	let storage = window.localStorage;
	storage.setItem('token', 1); // 存储名为a值为1的变量
	storage.b = 2;           // 存储名为b值为2的变量
	storage['c'] = 3;        // 存储名为c值为3的变量
}
submit.onclick = function(){

	let storage = window.localStorage;
	var id = document.getElementById('id');
	var pwd = document.getElementById('pwd');
	var sign = document.getElementById('sign_in');
	var account = {"id":'2',"pwd":"fsfd"};
	account.id = id.value;
	account.pwd = pwd.value;
	account.token = storage.token;
	storage.id = account.id;
	console.log(JSON.stringify(account));
	var xhttp = new XMLHttpRequest();
	//xhttp.open("GET", "/account/sign_in?json=" + JSON.stringify(obj) , false);
	xhttp.open("post", "/account/sign_in" , false);
	xhttp.send(JSON.stringify(account));
	console.log(xhttp.responseText);
	var obj = JSON.parse(xhttp.responseText);
	storage.token = obj.token;
	if (obj.error) {
		document.getElementById("demo").innerHTML = obj.error;
	} else if (obj.token) {
		document.getElementById("demo").innerHTML = obj.token;
	//jump
		top.window.location.href="car/driver.html?token=" + storage.token + "&id=" + storage.id;
	}
}
